import React, { useState } from "react"
import { Button, Form, Input, Checkbox, TimePicker, Switch,DatePicker } from 'antd'
import "./"
import moment from 'moment' /// 日期格式化
import "./index.css"
import Pictures from "../../../../../component/Pictures"

// const { RangePicker } = DatePicker;
const Setting = () => {
    const [value, setValue] = useState("00:00:00");
    const [valuess, setValues] = useState("00:00:00");
    /// 完成提交
    const onFinish = (values) => {
        console.log('Success:', values);
        setTimeout(() => {
            alert("提交成功")
        }, 800)
    };
    const options = [
        { label: '快递', value: '快递' },
        { label: '自提', value: '自提' },
        { label: '团长配送', value: '团长配送' },
    ];
    /// 发货方式改变
    function onChanges(checkedValues) {
        console.log('checked = ', checkedValues);
    }
    /// 休市时间
    function onChang(time, timeString) {
        console.log(111)
        setTimeout(() => {
            setValue(timeString);
            console.log(value)
        }, 0)
    };
    function onChan(time, timeString) {
        console.log(timeString)
        setValues(timeString);
        console.log(valuess)
    };
    /// 团长申请海报
    const handling = (e) => {
        console.log(e.response)
    }
    return <div className='setting'>
        <div className="three">
            <Form onFinish={onFinish}>
                <Form.Item label="开启社区团购"
                    valuePropName="checked">
                    <Switch />
                </Form.Item>
                <Form.Item
                    label="公告"
                    name="username"
                    rules={[
                        {
                            required: true,
                            message: '请输入公告名!',
                        },
                    ]}
                >
                    <Input placeholder="今日秒杀" />
                </Form.Item>
                <Form.Item label="休市时间">
                    <TimePicker onChange={onChang} value={moment(value, 'HH:mm:ss')} />
                    <TimePicker onChange={onChan} value={moment(valuess, 'HH:mm:ss')} />
                    {/* <RangePicker showTime /> */}
                </Form.Item>
                <Form.Item label="团长申请海报">
                    <Pictures content={handling} ></Pictures>
                </Form.Item>
                <Form.Item label="发货方式">
                    <Checkbox.Group options={options}
                        defaultValue={['Apple']}
                        onChange={onChanges} />
                </Form.Item>
                <Form.Item
                    label="自定义团长名称"
                    name="mingchneg1"
                    rules={[
                        {
                            required: true,
                            message: '请输入团长用户名!',
                        },
                    ]}
                >
                    <Input placeholder="团长" />
                </Form.Item>
                <Form.Item
                    label="团长覆盖范围"
                    name="fanwei"
                    rules={[
                        {
                            required: true,
                            message: '请输入团长覆盖范围!',
                        },
                    ]}
                >
                    <Input placeholder="99.999999" />
                </Form.Item>
                <Form.Item
                    label="提现手续费"
                    name="shouxv"
                    rules={[
                        {
                            required: true,
                            message: '请输入提现手续费!',
                        },
                    ]}
                >
                    <Input placeholder="0.00" />
                </Form.Item>
                <Form.Item
                    label="最低提现金额"
                    name="jine"
                    rules={[
                        {
                            required: true,
                            message: '请输入最低提现金额!',
                        },
                    ]}
                >
                    <Input placeholder="0.00" />
                </Form.Item>
                <Form.Item
                    label="团长佣金"
                    name="moneu"
                    rules={[
                        {
                            required: true,
                            message: '请输入团长佣金数值!',
                        },
                    ]}
                >
                    <Input placeholder="0.00" />
                </Form.Item>
                <Form.Item
                    wrapperCol={{
                        offset: 8,
                        span: 16,
                    }}
                >
                    <Button type="primary" htmlType="submit">
                        提交
                    </Button>
                </Form.Item>
            </Form>
        </div>

    </div>
}
export default Setting;
